<?php
namespace Admin\Controller;
use Think\Controller;

class GoodsController extends CommonController{
		//pp借贷信息列表
	public function lists(){
		$goods_list = D("Goods")->getGoodsList();
		$this->assign('goods_list',$goods_list);
		//dump($goods_list);

		$this->display();

	}

		//添加活动信息
		
		public function add(){
		


			if(IS_POST){

			//dump($_POST);	

				$data =array();
				$data['title']=I("title","",'');
				$data['money']=I("money",0,'float');   //散工工资
				$data['number']=I("number"); //招聘人数
				$data['mobile']=I("mobile");
				$data['email']=I("email");
				$data['address']=I("address");
				$data['companyname']=I("companyname","",''); //公司名称
				$data['des']=I("editorValue",'');  //招聘内容
				
				$data['create_time'] = NOW_TIME;


				


				D("goods")->add($data);
				//dump($data);
			
				header("Location:".U("goods/lists"));

			}else{

			$this->display();
			}
		}


		//散工信息编辑
		public function edite(){
			if(IS_POST){
				$data =array();
				$data['title'] = I("title","");
				$data['money']  = I("money","");
				$uid=I('get.id/d'); // 如果不存在$_GET['id'] 则返回0
				M("pp")->where("id ='{$uid}'")->save($data);

				//dump($data);
				//dump($uid);

				$this->redirect('Goods/lists');
			


			}else{
				$uid = I("id",0,"int");
				$activity_info =M("pp")->where("id='{$uid}'")->find();
				//dump($user_info);
				//dump($uid);
				$this->assign("goods_info",$goods_info);
				$this->display();		
			}
		}



		//散工信息删除,已经实现
		public function delete(){
			$uid = I('id/d');
			M("goods")->where("id='{$uid}'")->delete();
			//dump($uid);
			$this->redirect('Goods/lists');	


		}	



	    //结束



}
	